<template>
	<view class="page">
		<view class="top">
			<view class="line">
				<view class="lable">
					姓名
				</view>
				<view class="value">
					{{pro.dName}}
				</view>
			</view>
			<view class="line">
				<view class="lable">
					电话
				</view>
				<view class="value">
					{{pro.dPhone}}
				</view>
			</view>
			<view class="line">
				<view class="lable">
					身份证号
				</view>
				<view class="value">
					{{pro.idCard}}
				</view>
			</view>
		</view>
		<view class="cardbox">
			<view class="cardtitle">
				身份证照片
			</view>
			<view class="imgbox">
				<image class="img" :src="'https://changban.dianjingkeji.net/prod-api'+pro.dcardzheng" @click="lookimage(pro.dcardzheng)"></image>
				<image class="img" :src="'https://changban.dianjingkeji.net/prod-api'+pro.dcardfan" @click="lookimage(pro.dcardfan)"></image>
				
			</view>
		</view>
		<view class="putbox">
			<view class="puttitle">
				设置分润比例
			</view>
			<view class="putline">
				<input type="digit"  placeholder="请输入" v-model="bili"/>
				%
			</view>
		</view>
		<view class="footbtn">
			<view class="itembtn orange"  @click="jujue">
				拒绝
			</view>
			<view class="itembtn " @click="tongguo">
				通过
			</view>
		</view>
	</view>
</template>

<script>
	import {shenheDaili} from '../../utils/daili.js'
	export default {
		data() {
			return {
				bili:'',
				pro:{}
			}
		},
		onLoad(e) {
			this.pro=JSON.parse(e.pro)
		},
		methods: {
			
			//查看身份证照片
			lookimage(e){
					uni.previewImage({
							urls: ['https://changban.dianjingkeji.net/prod-api'+e],
							longPressActions: {
								itemList: ['发送给朋友', '保存图片', '收藏'],
								success: function(data) {
									console.log('选中了第' + (data.tapIndex + 1) + '个按钮,第' + (data.index + 1) + '张图片');
								},
								fail: function(err) {
									console.log(err.errMsg);
								}
							}
						});
			},
			
			//拒绝申请
			jujue(){
				let that=this
				uni.showModal({
					title: '提示',
					content: '拒绝该用户的申请',
					success: function (res) {
						if (res.confirm) {
							console.log('用户点击确定');
							let p={
								phone:uni.getStorageSync('phone'),
								dailiId:that.pro.id,
								bili:'',
								reviewerstatus:2
							}
							shenheDaili(p).then(res=>{
								if(res.data.code==200){
									uni.showToast({
										title: '已拒绝',
										duration: 2000
									});
									setTimeout(()=>{
										uni.navigateBack()
									},2000)
							
								}
							})
							
						} else if (res.cancel) {
							console.log('用户点击取消');
						}
					}
				});

			},
			
			//通过申请
			tongguo(){
				let that=this
				uni.showModal({
					title: '提示',
					content: '通过该用户的申请',
					success: function (res) {
						if (res.confirm) {
							console.log('用户点击确定');
							let p={
								phone:uni.getStorageSync('phone'),
								dailiId:that.pro.id,
								bili:that.bili,
								reviewerstatus:1
							}
							shenheDaili(p).then(res=>{
								if(res.data.code==200){
									uni.showToast({
										title: '审核通过',
										duration: 2000
									});
									setTimeout(()=>{
										uni.navigateBack()
									},2000)

								}
							})
						} else if (res.cancel) {
							console.log('用户点击取消');
						}
					}
				});
			
			},
		}
	}
</script>

<style lang="less" scoped>
   .page{
	   width: 750rpx;
	   box-sizing: border-box;
	   padding: 20rpx;
	   .top{
		   width: 100%;
		   box-sizing: border-box;
		   background-color: white;
		   .line{
			   width: 100%;
			    box-sizing: border-box;
				
				padding: 40rpx 30rpx;
			   display: flex;
			   align-items: center;
			   justify-content: space-between;
			   font-weight: bold;
			
		   }
	   }
	   .cardbox{
		   width: 100%;
		   box-sizing: border-box;
		   background-color: white;
		    margin-top: 30rpx;
		   padding: 20rpx;
		   .cardtitle{
			   font-weight: bold;
			   margin: 20rpx 0rpx;
		   }
		   .imgbox{
			   width: 100%;
			   margin-top: 40rpx;
			   height: 250rpx;
			   display: flex;
			   align-items: center;
			   justify-content: space-between;
			   .img{
				   width: 310rpx;
				   height: 250rpx;
				   border-radius: 20rpx;
			   }
		   }
	   }
	   .putbox{
		  width: 100%;
		  box-sizing: border-box;
		  background-color: white;
		  padding: 30rpx; 
		  margin-top: 30rpx;
		  .puttitle{
			  font-weight: bold;
			  margin: 20rpx 0;
		  }
		  .putline{
			  width: 100%;
			  display: flex;
			  align-items: center;
			  justify-content: space-between;
			  font-size: 40rpx;
			  font-weight: bold;
			  
			  input{
				  width: 88%;
				  height: 60rpx;
				  font-size: 35rpx;
				  background-color: aliceblue;
				  padding: 2rpx 6rpx;
			  }
		  }
	   }
	   .footbtn{
		   width: 100%;
		   position: fixed;
		   height: 100rpx;
		   box-sizing: border-box;
		   display: flex;
		   align-items: center;
		   justify-content: space-evenly;
		   bottom: 20rpx;
		   right: 0;
		   .itembtn{
			   width: 250rpx;
			   height: 70rpx;
			   background-color: #1a4f8a;
			   color: white;
			   line-height: 70rpx;
			   border-radius: 35rpx;
			   text-align: center;
			   font-weight: bold;
		   }
		   .orange{
			   background-color: orangered;
		   }
	   }
	   
   }
</style>
